<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
</head>

<link rel="stylesheet" type="text/css" href="/Public/admin/lib/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/Public/admin/stylesheets/theme.css">
<link rel="stylesheet" href="/Public/admin/lib/font-awesome/css/font-awesome.css">
<script src="/Public/admin/lib/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="/Public/admin/lib/bootstrap/js/bootstrap.js"></script>
<!-- Demo page code -->
<style type="text/css">
    #line-chart {
        height:300px;
        width:800px;
        margin: 0px auto;
        margin-top: 1em;
    }
    .brand { font-family: georgia, serif; }
    .brand .first {
        color: #ccc;
        font-style: italic;
    }
    .brand .second {
        color: #fff;
        font-weight: bold;
    }
</style>
<body class="">
<!--<![endif]-->
<div class="navbar">
    <div class="navbar-inner">
        <ul class="nav pull-right">

            <li><a href="#" class="hidden-phone visible-tablet visible-desktop" role="button">Settings</a></li>
            <li id="fat-menu" class="dropdown">
                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="icon-user"></i> Jack Smith
                    <i class="icon-caret-down"></i>
                </a>

                <ul class="dropdown-menu">
                    <li><a tabindex="-1" href="#">My Account</a></li>
                    <li class="divider"></li>
                    <li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
                    <li class="divider visible-phone"></li>
                    <li><a tabindex="-1" href="sign-in.html">Logout</a></li>
                </ul>
            </li>

        </ul>
        <a class="brand" href="index.html"><span class="first">Your</span> <span class="second">Company</span></a>
    </div>
</div>
<div class="sidebar-nav">
    <a href="#dashboard-menu" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>Dashboard</a>
    <ul id="dashboard-menu" class="nav nav-list collapse in">
        <li><a href="/Admin/Index/index.html">首页</a></li>
        <li ><a href="/Admin/User/index.html">用户列表</a></li>
        <li ><a href="user.html">Sample Item</a></li>
        <li ><a href="media.html">Media</a></li>
        <li ><a href="calendar.html">Calendar</a></li>

    </ul>

    <a href="#accounts-menu" class="nav-header" data-toggle="collapse"><i class="icon-briefcase"></i>Account<span class="label label-info">+3</span></a>
    <ul id="accounts-menu" class="nav nav-list in collapse">
        <li ><a href="sign-in.html">Sign In</a></li>
        <li ><a href="sign-up.html">Sign Up</a></li>
        <li ><a href="reset-password.html">Reset Password</a></li>
    </ul>



    <a href="help.html" class="nav-header" ><i class="icon-question-sign"></i>Help</a>
    <a href="faq.html" class="nav-header" ><i class="icon-comment"></i>Faq</a>
</div>

<div class="content">

    <div class="header">
        <h1 class="page-title">添加用户</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="index.html">首页</a> <span class="divider">/</span></li>
        <li><a href="users.html">用户管理</a> <span class="divider">/</span></li>
        <li class="active">添加用户</li>
    </ul>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="well">
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="tab" action="/Admin/User/Add" method="post">
                            <label>用户名</label>
                            <input type="text" class="input-xlarge" name="user_name"/>
                            <label>职业</label>
                            <input type="text" class="input-xlarge" name="user_zhi">
                            <label>描述</label>
                            <textarea rows="3" class="input-xlarge" name="user_decrbit"></textarea>
                            <label></label>
                            <button class="btn btn-primary" type="submit"><i class="icon-save"></i> 保存</button><span id="tips" style="color:#ff231e;margin-left:12px;"></span>
                        </form>
                    </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function getspanval(i) {
        $('#tips').html(i);
    }
    $('#tab').submit(function () {
        var user_name = $('[name="user_name"]').val();
        var user_zhi = $('[name="user_zhi"]').val();
        var user_decrbit = $('[name="user_decrbit"]').val();
        getspanval('');
        if (user_name == '') {
            getspanval('请输入用户名');
            return false;
        }
        if (user_zhi == '') {
            getspanval('请输入职业');
            return false;
        }
        if (user_decrbit == '') {
            getspanval('请输入描述');
            return false;
        }
        $.ajax({
            url:'/Admin/User/add',
            type:'post',
            dataType:'json',
            data:{user_name:user_name, user_zhi:user_zhi, user_decrbit:user_decrbit},
            success: function(){
                alert('添加成功');
               setTimeout(function () {
                    window.location.href='/Admin/User/index';
               });
            },
            error:function() {
                getspanval('系统异常');
                return false;
            }
        });
        return false;
    });
</script>

</body>
</html>